#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read() {
    int f=0,t=0;
    char c=getchar();
    while(!isdigit(c)) t|=(c=='-'),c=getchar();
    while(isdigit(c)) f=(f<<3)+(f<<1)+c-48,c=getchar();
    return t?-f:f;
}
void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar('0'+x%10);
}
int ans=0,sum=0,cnt[85],b[85],a[85],top;
void dfs(int p,int n){
	if(p>n){
		int num=0;
		for(int i=1;i<=n;i++){
			for(int j=i;j<=n;j++){
				if(b[i]!=b[j]) continue;
				int pd=0;
				for(int k=i;;k++){
					if(b[k]!=b[j-(k-i+1)+1]){pd=1;break;}
					if(k>=j-(k-i+1)+1) break;
				}
				if(pd==0) num++;
			}
		}
		if(num>ans)ans=num,sum=0;
		if(num==ans) sum++;
		return;
	}
	for(int i=1;i<=top;i++){if(cnt[a[i]]){cnt[a[i]]--;b[p]=a[i];dfs(p+1,n);cnt[a[i]]++;}}
}
signed main(){
	freopen("palindrome.in","r",stdin);
	freopen("palindrome.out","w",stdout);
	int n=read();
	for(int i=1;i<=n;i++){int x=read();cnt[x]++;if(cnt[x]==1) a[++top]=x;}
	dfs(1,n);
	write(ans),putchar(' '),write(sum);
	return 0;
}
